import timeit


def main():
    class Solution:
        def longestCommonPrefix(self, strs):
            """
            :type strs: List[str]
            :rtype: str
            """
            if len(strs) == 0:
                return ""
            same =strs[:1][0]
            for i in strs:
                if same == i:
                    continue
                else:
                    same = self.getSame(list(i), list(same))
            return same

        def getSame(self, s, same):
            num = 0
            flag = True
            s_len = len(s)
            n_len= len(same)
            while flag:
                if num >= s_len or num >=n_len:
                    break
                if s[num] == same[num]:
                    num +=1
                else:
                    flag = False
            same = same[:num]
            return "".join(same)

    s = Solution()
    tolist = ["aa","aa"]
    print(s.longestCommonPrefix(tolist))


if __name__ == '__main__':
    t1 = timeit.timeit(stmt=main, number=1)
    print(t1)
